<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script type="text/javascript" src="../assets/js/vue.js"></script>
    <title>v-on事件监听器</title>
</head>
<body>
    <h1>v-on 事件监听器</h1>
    <hr>
    <div id="app">
       <p v-text="message+score"></p>
       <button v-on:click="plus">加分</button>
       <button @click="reduce">减分</button>
       <!--keyup.enter/13绑定回车确定-->
       <p><input type="text" @keyup.13="enter" v-model="inpu"></p>
    </div>
 
    <script type="text/javascript">
      var app=new Vue({
          el:'#app',
          data:{
            message:'本场得分：',
            score:0,
            inpu:0
          },
          methods:{
              plus:function(){
                  this.score++
              },
              reduce:function(){
                  this.score--
              },
              enter:function(){
                this.score+=parseInt(this.inpu);
              }
          }
      })
    </script>
</body>
</html>